package com.zdw.common.parent;

import lombok.Getter;
import lombok.Setter;

/**
 * JSON返回类
 */
@Getter
@Setter
public class JSONResult {

    // 状态码
    private int status = 200;

    //成功标识
    private boolean isSuccess = true;

    //消息
    private String msg;

    //返回数据
    private Object data;

    public JSONResult markSuccess(String msg) {
        this.msg = msg;
        return this;
    }

    public JSONResult markSuccess(String msg, Object data) {
        this.msg = msg;
        this.data = data;
        return this;
    }

    public JSONResult markFail(String msg) {
        this.msg = msg;
        this.isSuccess = false;
        return this;
    }

    public JSONResult markFail(String msg, Object data) {
        this.msg = msg;
        this.isSuccess = false;
        this.data = data;
        return this;
    }

    public JSONResult markFail(String msg, boolean isSuccess, int status) {
        this.msg = msg;
        this.isSuccess = isSuccess;
        this.status = status;
        return this;
    }

}